//
//  UIView+YGFrame.m
//  UIKit分类整合
//
//  Created by Mr.xu on 2017/1/8.
//  Copyright © 2017年 xuyaguang. All rights reserved.
//

#import "UIView+YGFrame.h"

@implementation UIView (YGFrame)

- (CGPoint)yg_origin {
    return self.frame.origin;
}

- (void)setYg_origin:(CGPoint)origin {
    CGRect newFrame = self.frame;
    newFrame.origin = origin;
    self.frame = newFrame;
}

- (CGFloat)yg_left {
    return self.frame.origin.x;
}

- (void)setYg_left:(CGFloat)yg_left {
    CGRect newFrame = self.frame;
    newFrame.origin.x = yg_left;
    self.frame = newFrame;
}

- (CGFloat)yg_top {
    return self.frame.origin.y;
}

- (void)setYg_top:(CGFloat)yg_top {
    CGRect newFrame = self.frame;
    newFrame.origin.y = yg_top;
    self.frame = newFrame;
}

- (CGFloat)yg_right {
    return self.frame.origin.x + self.frame.size.width;
}

- (void)setYg_right:(CGFloat)yg_right {
    CGRect newFrame = self.frame;
    newFrame.origin.x = yg_right - self.frame.size.width;
    self.frame = newFrame;
}

- (CGFloat)yg_bottom {
    return self.frame.origin.y + self.frame.size.height;
}

- (void)setYg_bottom:(CGFloat)yg_bottom {
    CGRect newFrame = self.frame;
    newFrame.origin.y = yg_bottom - self.frame.size.height;
    self.frame = newFrame;
}

- (CGFloat)yg_width {
    return self.frame.size.width;
}

- (void)setYg_width:(CGFloat)yg_width {
    CGRect newFrame = self.frame;
    newFrame.size.width = yg_width;
    self.frame = newFrame;
}

- (CGFloat)yg_height {
    return self.frame.size.height;
}

- (void)setYg_height:(CGFloat)yg_height {
    CGRect newFrame = self.frame;
    newFrame.size.height = yg_height;
    self.frame = newFrame;
}

- (CGSize)yg_size {
    return self.frame.size;
}

- (void)setYg_size:(CGSize)yg_size {
    CGRect newFrame = self.frame;
    newFrame.size = yg_size;
    self.frame = newFrame;
}

- (CGFloat)yg_centerX {
    return self.center.x;
}

- (void)setYg_centerX:(CGFloat)yg_centerX {
    CGPoint newCenter = self.center;
    newCenter.x = yg_centerX;
    self.center = newCenter;
}

- (CGFloat)yg_centerY {
    return self.center.y;
}

- (void)setYg_centerY:(CGFloat)yg_centerY {
    CGPoint newCenter = self.center;
    newCenter.y = yg_centerY;
    self.center = newCenter;
}
@end
